Local IP와 Local HostName 가져오기 - CSharp :: C#일반[SSISO Community]
 
SSISO 카페 SSISO Source SSISO 구직 SSISO 쇼핑몰 SSISO 맛집
추천검색어 : JUnit   Log4j   ajax   spring   struts   struts-config.xml   Synchronized   책정보   Ajax 마스터하기   우측부분

C#일반
[1]
등록일:2008-03-27 20:49:37 (0%)
작성자:갤러리정
제목:Local IP와 Local HostName 가져오기 - CSharp
using System;
    using System.Net;

    public class DNSUtility
    {
        public static int Main (string [] args)
        {

          String strHostName = "";
          if (args.Length == 0)
          {
              // Getting Ip address of local machine...
              // First get the host name of local machine.
              strHostName = Dns.GetHostName ();
              Console.WriteLine ("Local Machine's Host Name: " + strHostName);
          }
          else
          {
              strHostName = args[0];
          }

          // Then using host name, get the IP address list..
          IPHostEntry ipEntry = Dns.GetHostByName (strHostName);
          IPAddress [] addr = ipEntry.AddressList;

          for (int i = 0; i < addr.Length; i++)
          {
              Console.WriteLine ("IP Address {0}: {1} ", i, addr[i].ToString());
          }
          return 0;
        }
     }

 

자료출처 : Microsoft News Group

[본문링크] Local IP와 Local HostName 가져오기 - CSharp
[1]
코멘트(이글의 트랙백 주소:/cafe/tb_receive.php?no=3123
작성자
비밀번호

 

SSISOCommunity

[이전]

Copyright byCopyright ⓒ2005, SSISO Community All Rights Reserved.